home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / xmasspak / noter / noter2_0.asm < prev    next >
Encoding:
Assembly Source File  |  1996-03-26  |  35.5 KB  |  1,400 lines

  1. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  2. ; ESCAPE NOTE EDITOR v2.0
  3. ;
  4. ; done late march 1996 by Capella/Escape
  5. ;
  6. ;
  7. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  8. ideal
  9. p386n
  10.  
  11. assume ss:_stacking
  12.  
  13. segment  _stacking  stack
  14.  
  15.         db 1024 dup (?)
  16.  
  17. ends  _stacking
  18.  
  19. assume cs:coding
  20.  
  21. masm
  22. include bwsb.inc
  23. include gdmtype.inc
  24. ideal
  25.  
  26. macro   set_charset
  27.  
  28.         push es
  29.         mov ax,ds
  30.         mov es,ax
  31.         mov ax,1110h
  32.         mov bh,16
  33.         xor bl,bl
  34.         mov cx,256
  35.         xor dx,dx
  36.         mov bp,offset charset
  37.         int 10h
  38.         pop es
  39.  
  40. endm    set_charset
  41.  
  42. macro   cursor_off
  43.  
  44.         mov dx,03d4h
  45.         mov al,0ah
  46.         out dx,al
  47.         inc dx
  48.         in al,dx
  49.         mov [cs:oldcursor],al
  50.         mov al,32
  51.         out dx,al
  52.  
  53. endm    cursor_off
  54.  
  55. macro   cursor_on
  56.  
  57.         mov dx,03d4h
  58.         mov al,0ah
  59.         mov ah,[cs:oldcursor]
  60.         out dx,ax
  61.  
  62. endm    cursor_on
  63.  
  64. noter_length    = 4936
  65. replay_length   = 34837
  66. char_length     = 4096
  67.  
  68.  
  69.  
  70. segment         coding
  71.  
  72. oldcursor       db 0
  73.  
  74. start:
  75.                 push es
  76.  
  77.                 pushad
  78.                 mov ax,4a00h
  79.                 mov bx,141000/16+1
  80.                 int 21h
  81.                 popad
  82.  
  83.                 pop es
  84.  
  85.                 mov ax,[es:2ch]
  86.                 mov [cs:env_block],ax
  87.  
  88.                 mov ax,miscdata
  89.                 mov ds,ax
  90.  
  91.                 mov ax,0b800h
  92.                 mov es,ax
  93.  
  94.                 mov ax,textdata
  95.                 mov gs,ax
  96.  
  97.                 nop
  98.                 nop
  99.                 nop
  100.                 nop
  101.  
  102.                 mov ax,[cs:env_block]
  103.                 mov fs,ax
  104.  
  105.                 xor di,di
  106.                 mov eax,00010000h
  107. env_loop:       cmp [dword fs:di],eax
  108.                 je _name_found
  109.                 inc di
  110.                 jmp env_loop
  111.  
  112. _name_found:
  113.                 add di,4
  114.                 xor si,si
  115. env_loop2:      mov al,[fs:di]
  116.                 or al,al
  117.                 jz end_env
  118.                 mov [ds:env_name+si],al
  119.                 inc si
  120.                 inc di
  121.                 jmp env_loop2
  122.  
  123. end_env:
  124.                 
  125. main_menu:      mov ax,0003h
  126.                 int 10h
  127.  
  128.                 cursor_off
  129.  
  130.                 mov si,offset menu1
  131.                 xor di,di
  132.                 call print_string
  133.  
  134. get_key1:
  135.                 xor ax,ax
  136.                 int 16h
  137.  
  138.                 cmp al,"r"
  139.                 je read_note
  140.                 cmp al,"R"
  141.                 je read_note
  142.  
  143.                 cmp al,"w"
  144.                 je write_note
  145.                 cmp al,"W"
  146.                 je write_note
  147.  
  148.                 cmp al,"s"
  149.                 je set_sound
  150.                 cmp al,"S"
  151.                 je set_sound
  152.  
  153.                 cmp al,"x"
  154.                 je _exit
  155.                 cmp al,"X"
  156.                 je _exit
  157.  
  158.                 jmp get_key1
  159.  
  160. ;====================================
  161. ; EXIT TO DOS
  162. ;====================================
  163. _exit:
  164.                 cmp [cs:sound_on],1
  165.                 jne normal_exit
  166.  
  167.                 call stopmusic
  168.                 call stopoutput
  169.                 call unloadmodule
  170.                 call freemse
  171.  
  172. normal_exit:    mov ax,0003h
  173.                 int 10h
  174.  
  175.                 cursor_on
  176.  
  177.                 xor di,di
  178.                 mov si,offset end_text
  179.                 call print_string
  180.  
  181.                 mov ax,4c00h
  182.                 int 21h
  183.  
  184. ;====================================
  185. ; WRITE NEW NOTE
  186. ;====================================
  187. write_note:
  188.                 cmp [byte cs:sound_on],1
  189.                 je write_menu
  190.                 jmp main_menu
  191. write_menu:
  192.                 clc                             ; load charset
  193.                 mov ax,3d00h
  194.                 mov dx,offset env_name
  195.                 int 21h
  196.                 mov bx,ax
  197.  
  198.                 mov ax,4200h                    ; set filepointer to charset
  199.                 xor cx,cx
  200.                 mov dx,noter_length+replay_length
  201.                 int 21h
  202.  
  203.                 mov ax,3f00h                    ; load charset
  204.                 mov dx,offset charset
  205.                 mov cx,4096
  206.                 int 21h
  207.  
  208.                 mov ax,3f00h                    ; load length-pointer
  209.                 mov dx,offset music_length
  210.                 mov cx,8
  211.                 int 21h
  212.                 
  213.                 mov ax,3e00h
  214.                 int 21h
  215.  
  216.                 clc
  217.                 mov ax,3d00h
  218.                 mov dx,offset env_name
  219.                 int 21h
  220.                 mov [cs:handle],ax
  221.  
  222.                 call emsexist                   ; check for ems to load in
  223.                 and al,1
  224.                 mov bl,al
  225.  
  226.                 mov ax,[cs:handle]              ; load da damned file
  227.                 mov ecx,8
  228.  
  229.                 add ecx,noter_length+replay_length+char_length
  230.  
  231.                 mov dx,ds
  232.                 mov di,offset modhead
  233.                 call LoadGDM
  234.                 or bx,bx
  235.                 jnz music_error
  236.  
  237.                 mov ax,3e00h                    ; close da shit...
  238.                 mov bx,[cs:handle]
  239.                 int 21h
  240.  
  241.                 mov ax,8
  242.                 call startoutput
  243.                 call startmusic
  244.                                 
  245. after_char:
  246.                 mov ax,0003h
  247.                 int 10h
  248.  
  249.                 cursor_off
  250.  
  251.                 set_charset
  252.  
  253.                 mov si,offset menu2
  254.                 xor di,di
  255.                 call print_string
  256.                 
  257. get_key2:       xor ax,ax
  258.                 int 16h
  259.  
  260.                 cmp al,"e"
  261.                 je edit_note
  262.                 cmp al,"E"
  263.                 je edit_note
  264.  
  265.                 cmp al,"m"
  266.                 je load_music
  267.                 cmp al,"M"
  268.                 je load_music
  269.  
  270.                 cmp al,"c"
  271.                 je load_charset
  272.                 cmp al,"C"
  273.                 je load_charset
  274.  
  275.                 cmp al,"s"
  276.                 je save_note
  277.                 cmp al,"S"
  278.                 je save_note
  279.  
  280.                 cmp al,"x"
  281.                 je _exit
  282.                 cmp al,"X"
  283.                 je _exit
  284.  
  285.                 jmp get_key2
  286. ;====================================
  287. ; READ ACTUAL NOTE
  288. ;====================================
  289. read_note:
  290.                 cmp [byte cs:sound_on],1
  291.                 je read_me
  292.                 jmp main_menu
  293.  
  294. read_me:
  295.                 mov ax,0003h
  296.                 int 10h
  297.                       
  298.               mov ax,1201h      ;disable DAC-setting
  299.               mov bx,31h
  300.               int 10h
  301.  
  302.               mov dx,03dah      ;reset Flip-Flop
  303.               in al,dx
  304.  
  305.               mov cx,16         ;merge DAC with 16mode-colorlines
  306.               mov dx,03c0h
  307.               xor al,al
  308. set_p:        out dx,al
  309.               out dx,al
  310.               inc al
  311.               dec cx
  312.               jnz set_p
  313.  
  314.               mov dx,03dah     ;reset Flip-Flop
  315.               in al,dx
  316.  
  317.               mov dx,03c0h     ;reset sequence-controller
  318.               mov al,32
  319.               out dx,al
  320.  
  321.               mov dx,03c8h
  322.               mov al,07h
  323.               out dx,al
  324.               xor al,al
  325.               inc dx  
  326.               out dx,al
  327.               out dx,al
  328.               out dx,al
  329.  
  330.               mov [word ds:pagepos],0
  331.  
  332.                 ;------------------------------------------------------
  333.                 clc                             ; load charset        
  334.                 mov ax,3d00h
  335.                 mov dx,offset env_name
  336.                 int 21h
  337.                 mov bx,ax
  338.  
  339.                 mov ax,4200h                    ; set filepointer to charset
  340.                 xor cx,cx
  341.                 mov dx,noter_length+replay_length
  342.                 int 21h
  343.  
  344.                 mov ax,3f00h                    ; load charset
  345.                 mov dx,offset charset
  346.                 mov cx,4096
  347.                 int 21h
  348.  
  349.                 mov ax,3f00h                    ; load length-pointer
  350.                 mov dx,offset music_length
  351.                 mov cx,8
  352.                 int 21h
  353.  
  354.                 mov ax,3e00h                    ; close da shit.....
  355.                 int 21h
  356.  
  357.                 
  358.                 ;------------------------------------------------------
  359.                 clc
  360.                 mov ax,3d00h
  361.                 mov dx,offset env_name
  362.                 int 21h
  363.                 mov [cs:handle],ax
  364.  
  365.                 call emsexist                   ; check for ems to load in
  366.                 and al,1
  367.                 mov bl,al
  368.  
  369.                 mov ax,[cs:handle]              ; load da damned file
  370.                 mov ecx,8
  371.  
  372.                 add ecx,noter_length+replay_length+char_length
  373.  
  374.                 mov dx,ds
  375.                 mov di,offset modhead
  376.                 call LoadGDM
  377.                 or bx,bx
  378.                 jnz music_error
  379.  
  380.                 mov ax,3e00h                    ; close da shit...
  381.                 mov bx,[cs:handle]
  382.                 int 21h
  383.  
  384.                 ;------------------------------------------------------
  385.  
  386.                 clc                             ; load da textfile
  387.                 mov ax,3d00h
  388.                 mov dx,offset env_name
  389.                 int 21h
  390.                 mov bx,ax
  391.  
  392.                 add [dword ds:music_length],8+noter_length+replay_length+char_length
  393.  
  394.                 mov ax,4200h
  395.                 mov dx,[word ds:music_length]
  396.                 mov cx,[word ds:music_length+2]
  397.                 int 21h
  398.  
  399.                 mov cx,0ffffh
  400.  
  401.                 push ds
  402.                 mov ax,loaddata
  403.                 mov ds,ax
  404.  
  405.                 mov ax,3f00h
  406.                 xor dx,dx
  407.                 int 21h
  408.  
  409.                 pop ds
  410.  
  411.                 mov ax,3e00h
  412.                 int 21h
  413.                 
  414.                 ;------------------------------------------------------
  415.                 push es
  416.                 push fs
  417.  
  418.                 xor si,si
  419.                 xor di,di
  420.  
  421.                 mov ax,loaddata
  422.                 mov es,ax
  423.                 mov ax,textdata
  424.                 mov fs,ax
  425.  
  426.                 call unpack_it
  427.  
  428.                 pop fs
  429.                 pop es
  430.  
  431.                 set_charset
  432.  
  433.                 cursor_off
  434.                                 
  435.                 mov ax,8
  436.                 call startoutput                ; start the music-output
  437.                 call startmusic
  438.  
  439.                 ;------------------------------------------------------
  440.  
  441.                 mov si,[ds:pagepos]
  442.                 call ram2screen
  443.                 call fade_in
  444.  
  445. get_key3:
  446.                 xor ax,ax
  447.                 int 16h
  448.  
  449.                 cmp al," "
  450.                 je next_page
  451.  
  452.                 cmp al,"x"
  453.                 je jump_exit
  454.                 cmp al,"X"
  455.                 je jump_exit
  456.  
  457.                 jmp get_key3
  458.  
  459. next_page:      mov si,[ds:pagepos]
  460.                 add si,2000
  461.                 cmp si,[ds:pages]
  462.                 jne go_page
  463.                 xor si,si
  464. go_page:        mov [ds:pagepos],si
  465.  
  466.                 call fade_out
  467.                 call ram2screen
  468.                 call fade_in
  469.  
  470.                 jmp get_key3
  471.  
  472. jump_exit:
  473.                 jmp _exit
  474.  
  475.                 
  476. fade_in:
  477.                 mov ah,0
  478. fade_in2:       mov dx,03c8h
  479.                 mov al,07h
  480.                 out dx,al
  481.                 inc dx
  482.                 mov al,ah  
  483.                 out dx,al
  484.                 out dx,al
  485.                 out dx,al
  486.                 push ax
  487.  
  488.                 mov dx,03dah
  489. wb1:            in al,dx
  490.                 test al,8
  491.                 jne wb1
  492. wb2:            in al,dx
  493.                 test al,8
  494.                 je wb2
  495.  
  496.                 pop ax
  497.                 add ah,2
  498.                 cmp ah,50
  499.                 jne fade_in2
  500.                 ret
  501.  
  502. fade_out:
  503.                 mov ah,50
  504. fade_out2:      mov dx,03c8h
  505.                 mov al,07h
  506.                 out dx,al
  507.                 inc dx
  508.                 mov al,ah
  509.                 out dx,al
  510.                 out dx,al
  511.                 out dx,al
  512.                 push ax
  513.  
  514.                 mov dx,03dah
  515. wb3:            in al,dx
  516.                 test al,8
  517.                 jne wb3
  518. wb4:            in al,dx
  519.                 test al,8
  520.                 je wb4
  521.  
  522.                 pop ax
  523.                 sub ah,2
  524.                 or ah,ah
  525.                 jne fade_out2
  526.                 ret
  527.  
  528.  
  529.  
  530. ;====================================
  531. ; SET SOUNDDEVICE
  532. ;====================================
  533. sound_on        db 0
  534.  
  535. set_sound:
  536.                 mov ax,0003h
  537.                 int 10h
  538.  
  539.                 cursor_off
  540.  
  541.                 mov si,offset menu3
  542.                 xor di,di
  543.                 call print_string
  544.  
  545. get_key4:
  546.                 xor ax,ax
  547.                 int 16h
  548.  
  549.                 cmp al,"g"
  550.                 je gus_set
  551.                 cmp al,"G"
  552.                 je gus_set
  553.  
  554.                 cmp al,"s"
  555.                 je sb_set
  556.                 cmp al,"S"
  557.                 je sb_set
  558.  
  559.                 cmp al,"p"
  560.                 je pas_set
  561.                 cmp al,"P"
  562.                 je pas_set
  563.  
  564.                 jmp get_key4
  565.  
  566. gus_set:        mov edi,noter_length
  567.                 mov ah,48
  568.                 jmp load_device
  569.  
  570. sb_set:         mov edi,12126
  571.                 add edi,noter_length 
  572.                 mov ah,22
  573.                 jmp load_device
  574.  
  575. pas_set:        mov edi,12126+11567
  576.                 add edi,noter_length
  577.                 mov ah,22
  578.  
  579. load_device:    mov bx,offset env_name
  580.                 mov al,10
  581.                 mov dx,0ffffh
  582.                 mov cx,0ffffh
  583.                 call LoadMSE
  584.                 or ax,ax
  585.                 jz all_ok
  586.  
  587.                 jmp _exit
  588.  
  589. all_ok:         mov [byte cs:sound_on],1
  590.  
  591.                 jmp main_menu
  592. ;====================================
  593. ; LOAD CHARSET
  594. ;====================================
  595. load_charset:
  596.                 cursor_on
  597.  
  598.                 call ask_file
  599.                 
  600.                 mov cx,8
  601.                 mov si,10*2+19*160
  602.                 mov di,offset charname
  603. next_char2:     mov al,[es:si]
  604.                 mov [ds:di],al
  605.                 add si,2
  606.                 inc di
  607.                 dec cx
  608.                 jnz next_char2
  609.  
  610.                 mov ax,3d02h
  611.                 mov dx,offset charname
  612.                 int 21h
  613.                 jc char_error
  614.                 mov bx,ax
  615.  
  616.                 mov ah,3fh
  617.                 mov cx,4096
  618.                 mov dx,offset charset
  619.                 int 21h
  620.  
  621.                 mov ah,3eh
  622.                 int 21h
  623.  
  624.                 jmp after_char
  625.  
  626. char_error:
  627.                 mov cx,15
  628.                 mov di,10*2+19*160
  629.                 mov si,offset not_found
  630.                 mov ah,04
  631. char_e:         mov al,[ds:si]
  632.                 mov [es:di],ax
  633.                 inc si
  634.                 add di,2
  635.                 dec cx
  636.                 jnz char_e
  637.  
  638.                 cursor_off
  639.                                
  640.                 jmp get_key2
  641.  
  642. ;====================================
  643. ; LOAD MUSIC
  644. ;====================================
  645.  
  646. handle          dw 0
  647. new_music       db 0
  648.  
  649. load_music:
  650.  
  651.                 cursor_on
  652.  
  653.                 call ask_file
  654.                 
  655.                 mov cx,8
  656.                 mov si,10*2+19*160
  657.                 mov di,offset modname
  658. next_char3:     mov al,[es:si]
  659.                 mov [ds:di],al
  660.                 add si,2
  661.                 inc di
  662.                 dec cx
  663.                 jnz next_char3
  664.  
  665.                 clc                             ; open music-file to read
  666.                 mov ax,3d00h
  667.                 mov dx,offset modname
  668.                 int 21h
  669.                 jc music_error
  670.                 mov [cs:handle],ax
  671.  
  672.                 mov ax,4202h                    ; get file_length
  673.                 xor cx,cx
  674.                 xor dx,dx
  675.                 mov bx,[cs:handle]
  676.                 int 21h
  677.  
  678.                 mov [word ds:music_length],ax        ; store length of file
  679.                 mov [word ds:music_length+2],dx
  680.                 
  681.                 mov ax,4200h
  682.                 xor cx,cx
  683.                 xor dx,dx
  684.                 mov bx,[cs:handle]
  685.                 int 21h
  686.                 
  687.                                                 ; stop music-output
  688.                 call stopmusic
  689.                 call stopoutput
  690.                 call unloadmodule               ; remove old module 
  691.                 
  692.                 call emsexist                   ; check for ems to load in
  693.                 and al,1
  694.                 mov bl,al
  695.  
  696.                 mov ax,[cs:handle]              ; load da damned file
  697.                 xor ecx,ecx
  698.                 mov dx,ds
  699.                 mov di,offset modhead
  700.                 call LoadGDM
  701.                 or bx,bx
  702.                 jnz music_error
  703.  
  704.                 mov ax,3e00h                    ; close da shit...
  705.                 mov bx,[cs:handle]
  706.                 int 21h
  707.  
  708.                 mov [cs:new_music],1
  709.  
  710.                 mov ax,8
  711.                 call startoutput                ; start the music-output
  712.                 call startmusic
  713.  
  714.                 jmp after_char
  715.  
  716. music_error:                                    ; if error appears... 
  717.                 mov cx,15
  718.                 mov di,10*2+19*160
  719.                 mov si,offset not_found
  720.                 mov ah,04
  721. music_e:        mov al,[ds:si]
  722.                 mov [es:di],ax
  723.                 inc si
  724.                 add di,2
  725.                 dec cx
  726.                 jnz music_e
  727.  
  728.                 cursor_off
  729.  
  730.                 jmp get_key2
  731.  
  732. ;====================================
  733. ; EDIT TEXTPAGES
  734. ;====================================
  735. edit_note:
  736.                 mov ax,0003h
  737.                 int 10h
  738.  
  739.                 set_charset
  740.  
  741.                 xor ax,ax
  742.                 mov [ds:ypos],ax
  743.                 mov [ds:xpos],ax
  744.                 mov [ds:yoff],ax
  745.                 mov [ds:xoff],ax
  746.                 call set_curpos2
  747.  
  748. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  749. ; THE EDIT-ROUTINE 
  750. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  751.  
  752. edit_me:        mov ah,02h
  753.                 xor bh,bh
  754.                 mov dh,[byte ds:ypos]
  755.                 add dh,[byte ds:yoff]
  756.                 mov dl,[byte ds:xpos]
  757.                 add dl,[byte ds:xoff]
  758.                 int 10h
  759.  
  760.                 mov si,[ds:pagepos]
  761.                 call ram2screen
  762.  
  763. getkey:         xor ax,ax
  764.                 int 16h 
  765.                 or al,al
  766.                 jz exp_code
  767.  
  768.                 cmp al,1bh
  769.                 je exit_vote
  770.                 cmp al,0dh
  771.                 je return
  772.                 cmp al,08h
  773.                 je delete
  774.                 cmp al,09h
  775.                 je tab_move
  776.                 jmp print_char
  777.  
  778. exp_code:       cmp ah,4fh
  779.                 je end_pos
  780.                 cmp ah,47h
  781.                 je first_pos
  782.                 cmp ah,48h
  783.                 je y_dec
  784.                 cmp ah,50h
  785.                 je y_inc
  786.                 cmp ah,4bh
  787.                 je x_dec
  788.                 cmp ah,4dh
  789.                 je x_inc
  790.                 cmp ah,51h
  791.                 je page_up
  792.                 cmp ah,49h
  793.                 je page_down
  794.  
  795. print_char:     mov di,[ds:yoff]
  796.                 add di,[ds:ypos]
  797.                 imul di,160
  798.  
  799.                 mov bx,[ds:xoff]
  800.                 add bx,[ds:xpos]
  801.                 shl bx,1
  802.                 add di,bx
  803.                 
  804.                 mov [es:di],al
  805.                 jmp x_inc
  806.  
  807. exit_vote:      mov si,[ds:pagepos]
  808.                 add si,2000
  809.                 mov [ds:pages],si
  810.                 sub si,2000
  811.                 call screen2ram
  812.                 cursor_off
  813.                 jmp after_char
  814.  
  815.  
  816. return:         mov di,[ds:ypos]
  817.                 inc di
  818.                 cmp di,10
  819.                 jne ret1
  820.                 jmp getkey
  821. ret1:           mov [ds:ypos],di
  822.                 mov [ds:xpos],0
  823.                 jmp set_curpos
  824.  
  825. delete:
  826.                  
  827.                 mov ax,[ds:xpos]
  828.                 dec ax
  829.                 cmp ax,0ffffh
  830.                 jne del1
  831.                 jmp getkey
  832. del1:           mov [ds:xpos],ax
  833.  
  834.                 mov di,[ds:ypos]
  835.                 add di,[ds:yoff]
  836.                 imul di,160
  837.                 
  838.                 mov bx,[ds:xoff]
  839.                 add bx,[ds:xpos]
  840.                 shl bx,1
  841.                 add di,bx
  842.  
  843.                 mov al,20h
  844.                 mov [es:di],al
  845.  
  846.                 jmp set_curpos
  847.  
  848.  
  849. tab_move:       mov ax,[ds:xpos]
  850.                 add ax,8
  851.                 cmp ax,80
  852.                 jb xx2
  853.                 mov ax,79
  854. xx2:            mov [ds:xpos],ax
  855.                 jmp set_curpos
  856.  
  857.  
  858. end_pos:        
  859.                 mov [word ds:xpos],79
  860.                 call set_curpos2
  861.  
  862. ep1:            mov di,[ds:ypos]
  863.                 add di,[ds:yoff]
  864.                 imul di,160
  865.                 
  866.                 mov bx,[ds:xoff]
  867.                 add bx,[ds:xpos]
  868.                 shl bx,1
  869.                 add di,bx
  870.  
  871.                 cmp [byte es:di],32
  872.                 jne set_it
  873.  
  874.                 mov ax,[ds:xpos]
  875.                 or ax,ax
  876.                 jz set_it2
  877.                 dec ax
  878.                 mov [ds:xpos],ax
  879.                 jmp ep1
  880.  
  881. set_it2:        mov [ds:xpos],ax
  882.                 jmp set_curpos
  883.  
  884.  
  885. set_it:                         
  886.                 jmp set_curpos
  887.  
  888.  
  889. first_pos:      mov [word ds:xpos],0
  890.                 
  891.                 jmp set_curpos
  892.  
  893.  
  894.  
  895. y_dec:          mov ax,[ds:ypos]
  896.                 dec ax
  897.                 cmp ax,0ffffh
  898.                 jne y1
  899.                 jmp getkey
  900. y1:             mov [ds:ypos],ax
  901.                 jmp set_curpos
  902.  
  903. y_inc:          mov ax,[ds:ypos]
  904.                 inc ax
  905.                 cmp ax,25
  906.                 jne y2
  907.                 jmp getkey
  908. y2:             mov [ds:ypos],ax
  909.                 jmp set_curpos
  910.  
  911. x_dec:          mov ax,[ds:xpos]
  912.                 dec ax
  913.                 cmp ax,0ffffh
  914.                 jne x1
  915.                 jmp getkey
  916. x1:             mov [ds:xpos],ax
  917.                 jmp set_curpos
  918.  
  919. x_inc:          mov ax,[ds:xpos]
  920.                 inc ax
  921.                 cmp ax,80
  922.                 jne x2
  923.                 jmp getkey
  924. x2:             mov [ds:xpos],ax
  925.                 jmp set_curpos
  926.  
  927. page_up:        mov si,[ds:pagepos]
  928.                 cmp si,31*2000
  929.                 je pge1
  930.                 call screen2ram
  931.                 add si,2000
  932.                 mov [ds:pagepos],si
  933.                 call ram2screen
  934. pge1:           jmp getkey
  935.                 
  936.  
  937. page_down:      mov si,[ds:pagepos]
  938.                 or si,si
  939.                 jz pge2
  940.                 call screen2ram
  941.                 sub si,2000
  942.                 mov [ds:pagepos],si
  943.                 call ram2screen
  944. pge2:           jmp getkey
  945.  
  946. set_curpos:     mov ah,02h
  947.                 xor bh,bh
  948.                 mov dh,[byte ds:ypos]
  949.                 add dh,[byte ds:yoff]
  950.                 mov dl,[byte ds:xpos]
  951.                 add dl,[byte ds:xoff]
  952.                 int 10h
  953.                 jmp getkey
  954.  
  955. screen2ram:     push si
  956.                 mov cx,2000
  957.                 xor di,di
  958. scr1:           mov al,[es:di]
  959.                 mov [gs:si],al
  960.                 add di,2
  961.                 inc si
  962.                 dec cx
  963.                 jnz scr1
  964.                 pop si
  965.                 ret
  966.  
  967. ram2screen:     push si
  968.                 mov cx,2000
  969.                 xor di,di
  970. scr2:           mov al,[gs:si]
  971.                 mov [es:di],al
  972.                 add di,2
  973.                 inc si
  974.                 dec cx
  975.                 jnz scr2
  976.                 pop si
  977.                 ret
  978.  
  979. ;====================================
  980. ; SAVE NEW NOTE
  981. ;====================================
  982.  
  983. env_block       dw 0
  984. handle2         dw 0
  985.  
  986. save_note:
  987.                 cursor_on
  988.  
  989.                 call ask_file
  990.                 
  991.                 mov cx,8
  992.                 mov si,10*2+19*160
  993.                 mov di,offset notename
  994. next_char4:     mov al,[es:si]
  995.                 mov [ds:di],al
  996.                 add si,2
  997.                 inc di
  998.                 dec cx
  999.                 jnz next_char4
  1000.  
  1001.                 cursor_off
  1002.  
  1003.                 clc                             ; create new file
  1004.                 mov ax,3c00h
  1005.                 xor cx,cx
  1006.                 mov dx,offset notename
  1007.                 int 21h
  1008.                 mov [cs:handle],ax
  1009.  
  1010.                 clc
  1011.                 mov ax,3d00h                    ; open old note-file
  1012.                 mov dx,offset env_name
  1013.                 int 21h
  1014.                 jnc _ok
  1015.                 jmp _exit
  1016. _ok:
  1017.                 mov [cs:handle2],ax
  1018.  
  1019.                 push ds
  1020.  
  1021.                 mov ax,loaddata
  1022.                 mov ds,ax
  1023.                
  1024.                 mov ax,3f00h                      ; read noter-programm and
  1025.                 mov cx,noter_length+replay_length ; replay-routines
  1026.                 xor dx,dx
  1027.                 mov bx,[cs:handle2]
  1028.                 int 21h
  1029.  
  1030.                 mov ax,4000h
  1031.                 mov cx,noter_length+replay_length
  1032.                 xor dx,dx
  1033.                 mov bx,[cs:handle]
  1034.                 int 21h
  1035.  
  1036.                 pop ds
  1037.  
  1038.                 mov ax,3e00h
  1039.                 mov bx,[cs:handle2]
  1040.                 int 21h
  1041.                 
  1042.                 mov ax,4000h                    ; save charset
  1043.                 mov dx,offset charset
  1044.                 mov cx,4096
  1045.                 mov bx,[cs:handle]
  1046.                 int 21h
  1047.  
  1048.                 ;---------------------------------------------------
  1049.  
  1050.                 mov ax,4000h                    ; save length-pointer
  1051.                 mov dx,offset music_length
  1052.                 mov cx,8
  1053.                 mov bx,[cs:handle]
  1054.                 int 21h
  1055.                 
  1056.                 cmp [cs:new_music],1
  1057.                 je its_new2
  1058.                 jmp old_music
  1059.  
  1060. its_new2:       clc                             ; open music_file
  1061.                 mov ax,3d00h
  1062.                 mov dx,offset modname
  1063.                 int 21h
  1064.                 mov [cs:handle2],ax
  1065.  
  1066.                 mov cx,0ffffh
  1067.  
  1068. its_old2:       push ds                         ; load_music_file
  1069.  
  1070.                 mov ax,loaddata
  1071.                 mov ds,ax
  1072.                 
  1073.                 mov ax,3f00h
  1074.                 xor dx,dx
  1075.                 mov bx,[cs:handle2]
  1076.                 int 21h
  1077.                 mov cx,ax
  1078.  
  1079.                 mov ax,4000h                   ; save music_file
  1080.                 xor dx,dx
  1081.                 mov bx,[cs:handle]
  1082.                 int 21h
  1083.  
  1084.                 pop ds
  1085.  
  1086.                 mov ax,3e00h                    ; close music_file
  1087.                 mov bx,[cs:handle2]
  1088.                 int 21h
  1089.  
  1090.                 ;-------------------------------------------------------
  1091.  
  1092.                 push es                 ; pack textfile
  1093.                 push fs
  1094.  
  1095.                 mov ax,textdata
  1096.                 mov es,ax
  1097.                 mov ax,loaddata
  1098.                 mov fs,ax
  1099.  
  1100.                 call pack_it
  1101.  
  1102.                 pop fs
  1103.                 pop es
  1104.  
  1105.                 ;-------------------------------------------------------
  1106.  
  1107.                 mov cx,[ds:text_length]
  1108.  
  1109.                 push ds
  1110.  
  1111.                 mov ax,loaddata
  1112.                 mov ds,ax
  1113.  
  1114.                 mov ax,4000h
  1115.                 xor dx,dx
  1116.                 mov bx,[cs:handle]
  1117.                 int 21h
  1118.  
  1119.                 pop ds
  1120.  
  1121.                 mov ax,3e00h
  1122.                 mov bx,[cs:handle]
  1123.                 int 21h
  1124.                 
  1125.                 jmp get_key2
  1126.  
  1127. ;===========================
  1128. ; OLD_MUSIC TO SAVE
  1129. ;===========================
  1130. old_musiclength dw 0
  1131.  
  1132. old_music:      clc
  1133.                 mov ax,3d00h
  1134.                 mov dx,offset env_name
  1135.                 int 21h
  1136.                 mov [cs:handle2],ax
  1137.  
  1138.                 mov ax,4200h
  1139.                 mov dx,8+noter_length+replay_length+char_length
  1140.                 xor cx,cx
  1141.                 mov bx,[cs:handle2]
  1142.                 int 21h
  1143.                 
  1144.                 mov cx,[word ds:music_length]
  1145.  
  1146.                 jmp its_old2
  1147.                 
  1148. ;===========================
  1149. ; PRINT-STRING   / DS:SI = offset to textstring with '0' as eof
  1150. ;                  ES:DI = offset of screenposition to print it
  1151. ;                  code 0ffh + 'number' = color for writing
  1152. ;                  code 0feh = next_line
  1153. ;                  code 0fdh + 'number' = set number of spaces
  1154. ;===========================
  1155. _di     dw 0
  1156.  
  1157. print_string:
  1158.                 mov [cs:_di],di
  1159.                 mov ah,01h
  1160. loop_string:
  1161.                 mov al,[ds:si]
  1162.                 or al,al
  1163.                 jz end_string
  1164.                 cmp al,0ffh
  1165.                 je change_col
  1166.                 cmp al,0feh
  1167.                 je next_line
  1168.                 cmp al,0fdh
  1169.                 je next_row
  1170.                 mov [es:di],ax
  1171.                 inc si
  1172.                 add di,2
  1173.                 jmp loop_string
  1174. change_col:
  1175.                 mov ah,[ds:si+1]
  1176.                 add si,2
  1177.                 jmp loop_string
  1178. next_line:
  1179.                 mov di,[cs:_di]
  1180.                 add di,160
  1181.                 mov [cs:_di],di
  1182.                 inc si
  1183.                 jmp loop_string
  1184. next_row:
  1185.                 push bx
  1186.                 xor bx,bx
  1187.                 mov bl,[ds:si+1]
  1188.                 add si,2
  1189.                 shl bx,1
  1190.                 add di,bx
  1191.                 pop bx
  1192.                 jmp loop_string
  1193.                 
  1194. end_string:     ret
  1195.  
  1196. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  1197. ; THE FILENAME-INPUT-ROUTINE 
  1198. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  1199.  
  1200. ask_file:
  1201.  
  1202.                 mov di,10*2+19*160
  1203.                 mov eax,00200020h
  1204.                 mov cx,16/2
  1205. clear_f:        mov [es:di],eax
  1206.                 add di,4
  1207.                 dec cx
  1208.                 jnz clear_f
  1209.                 
  1210.                 mov ax,10
  1211.                 mov [ds:xoff],ax
  1212.                 xor ax,ax
  1213.                 mov [ds:ypos],ax
  1214.                 mov [ds:xpos],ax
  1215.                 mov ax,19
  1216.                 mov [ds:yoff],ax
  1217.  
  1218.                 mov si,offset text1
  1219.                 mov cx,10
  1220.                 mov di,19*160
  1221.                 mov ah,07h
  1222. cop_v1:         mov al,[ds:si]
  1223.                 mov [es:di],ax
  1224.                 add di,2
  1225.                 inc si
  1226.                 dec cx
  1227.                 jnz cop_v1
  1228.  
  1229.                 call set_curpos2
  1230.                 jmp askkey
  1231.                            
  1232.  
  1233. set_curpos2:    mov ah,02h
  1234.                 xor bh,bh
  1235.                 mov dh,[byte ds:yoff]
  1236.                 add dh,[byte ds:ypos]
  1237.                 mov dl,[byte ds:xoff]
  1238.                 add dl,[byte ds:xpos]
  1239.                 int 10h
  1240.                 ret
  1241.  
  1242. askkey:         xor ax,ax
  1243.                 int 16h
  1244.                 or al,al
  1245.                 jz exp_code2
  1246.  
  1247.                 cmp al,1bh
  1248.                 je return2
  1249.                 cmp al,0dh
  1250.                 je return2
  1251.                 cmp al,08h
  1252.                 je delete2
  1253.                 jmp print_char2
  1254.  
  1255. exp_code2:      cmp ah,4bh
  1256.                 je x_dec2
  1257.                 cmp ah,4dh
  1258.                 je x_inc2
  1259.                
  1260. print_char2:    mov si,[ds:xoff]
  1261.                 add si,[ds:xpos]
  1262.                 shl si,1
  1263.                 mov bx,[ds:yoff]
  1264.                 add bx,[ds:ypos]
  1265.                 imul bx,160
  1266.                 add si,bx
  1267.                 mov ah,02h
  1268.                 mov [es:si],ax
  1269.                 jmp x_inc2
  1270.  
  1271. return2:        ret
  1272.  
  1273. delete2:        mov si,[ds:yoff]
  1274.                 add si,[ds:ypos]
  1275.                 imul si,160
  1276.                 mov bx,[ds:xoff]
  1277.                 add bx,[ds:xpos]
  1278.                 shl bx,1
  1279.                 add si,bx
  1280.                 xor al,al
  1281.                 mov [es:si],al
  1282.                 jmp x_dec2
  1283.  
  1284. x_dec2:         mov ax,[ds:xpos]
  1285.                 dec ax
  1286.                 cmp ax,0ffffh
  1287.                 jne x3
  1288.                 jmp askkey
  1289. x3:             mov [ds:xpos],ax
  1290.                 call set_curpos2
  1291.                 jmp askkey
  1292.  
  1293. x_inc2:         mov ax,[ds:xpos]
  1294.                 inc ax
  1295.                 cmp ax,8
  1296.                 jne x4
  1297.                 jmp askkey
  1298. x4:             mov [ds:xpos],ax
  1299.                 call set_curpos2
  1300.                 jmp askkey
  1301.  
  1302. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  1303. ; PACK / UNPACK - ROUTINES 
  1304. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  1305.  
  1306. include "pack.inc"
  1307. include "depack.inc"
  1308.  
  1309. ends  coding
  1310.  
  1311. segment         miscdata
  1312.  
  1313. masm
  1314. modhead        GDMHeader <?>
  1315. ideal
  1316.  
  1317. menu1           db 254,254,254,254,254,254,254
  1318.                 db 253,22,253, 7,255, 9,"»",255,11,"ESCAPE NOTER v2.0",255,9,"«",254
  1319.                 db 253,22,255, 1,"──────────────────────────────────",254,254
  1320.                 db 253,22,253, 7,255, 5," R ",255,8,"Read actual note",254
  1321.                 db 253,22,253, 7,255, 5," W ",255,8,"Write new note",254
  1322.                 db 253,22,253, 7,255, 5," S ",255,8,"Set sounddevice",254
  1323.                 db 253,22,253, 7,255, 5," X ",255,8,"Exit to DOS",254,254
  1324.                 db 253,22,255, 1,"──────────────────────────────────",254
  1325.                 db 253,22,255,14,253,3,"please make your choice.....",0
  1326.                               
  1327. menu2           db 254,254,254,254,254,254,254
  1328.                 db 253,22,253,10,255,11,"WRITE NEW NOTE",254
  1329.                 db 253,22,255, 1,"──────────────────────────────────",254,254
  1330.                 db 253,22,253, 7,255, 5," E ",255,8,"Edit textpages",254
  1331.                 db 253,22,253, 7,255, 5," M ",255,8,"Load new music",254
  1332.                 db 253,22,253, 7,255, 5," C ",255,8,"Load new charset",254
  1333.                 db 253,22,253, 7,255, 5," S ",255,8,"Save the note",254
  1334.                 db 253,22,253, 7,255, 5," X ",255,8,"Exit to DOS",254,254
  1335.                 db 253,22,255, 1,"──────────────────────────────────",254
  1336.                 db 253,22,255,14,253,3,"please make your choice.....",0
  1337.  
  1338. menu3           db 254,254,254,254,254,254,254
  1339.                 db 253,22,253,10,255,11,"SET SOUNDDEVICE",254
  1340.                 db 253,22,255, 1,"──────────────────────────────────",254,254
  1341.                 db 253,22,253, 7,255, 5," G ",255,8,"Gravis Ultrasound",254
  1342.                 db 253,22,253, 7,255, 5," S ",255,8,"SoundBlaster Pro",254
  1343.                 db 253,22,253, 7,255, 5," P ",255,8,"PAS",254
  1344.                 db 253,22,255, 1,"──────────────────────────────────",254
  1345.                 db 253,22,255,14,253,3,"please make your choice.....",0
  1346.                 
  1347.  
  1348. end_text        db 254,254,254,254,254
  1349.                 db 255,15,"ESCAPE NOTER v2.0 ",255,7,"done march 1996 "
  1350.                 db        "by Escape Factories",254
  1351.                 db 255,3,"e-mail: ascelon@aol.com / The Seven Gates +49-5254-958024",254
  1352.                 db 253,26,"Tales of Infinity +31-50-5734105",0
  1353.  
  1354. text1           db "Filename: "
  1355. not_found       db "FILE NOT FOUND!"
  1356.  
  1357. xpos            dw 0
  1358. ypos            dw 0
  1359. xoff            dw 0
  1360. yoff            dw 0
  1361. pagepos         dw 0
  1362.  
  1363.         db "ESCAPE"
  1364.  
  1365. music_length    dd 0
  1366. text_length     dw 0
  1367. pages           dw 0
  1368.  
  1369. modname         db 8 dup (0)
  1370.                 db ".gdm",0
  1371.  
  1372. charname        db 8 dup (0)
  1373.                 db ".fnt",0
  1374.  
  1375. notename        db 8 dup (0)
  1376.                 db ".exe",0
  1377.  
  1378. env_name        db "test    .exe",0
  1379.                 db 128 dup (0)
  1380.  
  1381.  
  1382. include "charset.inc"
  1383.  
  1384. ends  miscdata
  1385.  
  1386. segment         loaddata
  1387.  
  1388.                 db 65535 dup (?)
  1389.  
  1390. ends            loaddata
  1391.  
  1392. segment         textdata
  1393.  
  1394. _text           db 32*2000 dup (0)
  1395.  
  1396. ends            textdata
  1397.  
  1398. end     start
  1399.  
  1400.